<?php
require 'Model.php';
class TypeModel extends Model{
	function __Construct(){
		parent::__Construct();
		$this->mod='videotype';
	}
	function getList(){
			
			$sql = "select * from {$this->mod}";
			$data = $this->conn->query($sql);
			return $data;
		}
		function add($data)
		{
			
			$videotype = array(
				'typename'=>trim($data['typename'])
                 
				);
			$keys = implode(',',array_keys($videotype));
			$values = implode("','", array_values($videotype));
			$sql="insert into videotype ({$keys}) VALUES ('{$values}')";
			  //执行SQL语句
			
			$result = $this->conn->query($sql);
			return $result;
		}
		function getTypeByID($id){
			$sql = "select * from videotype where tid=".$id;
			$result = $this->conn->query($sql);
			return $result;
		}
		function update($data)
		{
			$videotype = array(
				
                  'id'=>$data['id'],
                'typename'=>trim($data['typename'])
				);
			
			    
			    $sql="UPDATE videotype SET {$sets} where tid=".$data['id'];
			  //执行SQL语句
			    $result = $this->conn->query($sql);
			    return $result;		    
			}
			function delete($id)
			{
				$sql = "delete from videotype where tid=".$id;
				$result = $this->conn->query($sql);
				return $result;
			}




		}
		?>